package cn.edu.scau.cmi.liangzaoqing.client;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import cn.edu.scau.cmi.liangzaoqing.spring.bean.Student;
//本例子使用Spring，学生、教师对象都预先封装好，直接获取使用
public class Spring02ApplicationContextClient {

	public static void main(String[] args) {
		ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml");
		Student zhangsan1 = (Student) applicationContext.getBean("zhangsan");
		
		System.out.println(zhangsan1);
		System.out.println(zhangsan1.getName() + "的毕业设计指导导师是：" + zhangsan1.getTutor().getName());
		
		ApplicationContext applicationContext2 = new ClassPathXmlApplicationContext("applicationContext.xml");
		Student zhangsan2 = (Student) applicationContext2.getBean("zhangsan");
		System.out.println(zhangsan2);
		System.out.println(zhangsan2.getName() + "的毕业设计指导导师是：" + zhangsan2.getTutor().getName());

	}
}